package com.zijie.hosptal.controller;

import com.zijie.hosptal.common.Result;
import com.zijie.hosptal.service.ChartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.Date;

@RestController
@RequestMapping("/charts")
public class ChartsController {

    private ChartsService chartsService;

    @Autowired
    public void setChartsService(ChartsService chartsService) {
        this.chartsService = chartsService;
    }

    @GetMapping("/hotCourse")
    public Result<?> hotCourse(){
        return null;
    }
    @GetMapping("/patientTotal")
    public Result<?> patientTotal(){
        Integer count = chartsService.getPatientTotal();
        return Result.success(count);
    }
    @GetMapping("/doctorTotal")
    public Result<?> doctorTotal(){
        Integer count=chartsService.getDoctorTotal();
        return Result.success(count);
    }
    @GetMapping("/doctorSchedulesTotal")
    public Result<?> doctorSchedulesTotal(){
        Integer count=chartsService.getDoctorSchedulesTotal();
        return Result.success(count);
    }
    @GetMapping("/reserveTotal")
    public Result<?> reserveTotal(){
        Integer count=chartsService.getReserveTotal();
        return Result.success(count);
    }
    @GetMapping("/doctorSchedules")
    public Result<?> doctorSchedules(@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") LocalDateTime date){
        return Result.success(chartsService.doctorSchedules(date));
    }
    @GetMapping("/weekDoctor")
    public Result<?> weekDoctor(@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") LocalDateTime date){
        return Result.success(chartsService.weekDoctor(date));
    }
    @GetMapping("/weekReserve")
    public Result<?> weekReserve(@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") LocalDateTime date){
        return Result.success(chartsService.weekReserve(date));
    }
    @GetMapping("/reserveCount")
    public Result<?> reserveCount(@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") LocalDateTime date){
        return Result.success(chartsService.reserveCount(date));
    }
    @GetMapping("/weekPatient")
    public Result<?> weekPatient(@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") LocalDateTime date){
        return Result.success(chartsService.weekPatient(date));
    }
    @GetMapping("/hotDoctor")
    public Result<?> hotDoctor(@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")LocalDateTime date){
        return Result.success(chartsService.hotDoctor(date));
    }
    @GetMapping("/hotDoctorSchedules")
    public Result<?> hotDoctorSchedules(@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")LocalDateTime date){
        return Result.success(chartsService.hotDoctorSchedules(date));
    }

}
